package xiaodou.core.WeiboData
{
	import flash.events.EventDispatcher;
	import flash.events.IEventDispatcher;
	import flash.utils.Dictionary;
	
	import spark.formatters.DateTimeFormatter;
	
	import xiaodou.core.WeiboData.WeiboStatusData;
	import xiaodou.core.WeiboData.events.WeiboDataEvent;
	import xiaodou.core.WeiboData.events.WeiboEvent;
	
	public class WeiboStatusInfo extends EventDispatcher
	{
		public var _StatusMentionMe:WeiboStatusData = new WeiboStatusData();//@我的微博
		public var _StatusSendbyMe:WeiboStatusData = new WeiboStatusData();//我发出的微博
		
		
		public function WeiboStatusInfo(target:IEventDispatcher=null)
		{
			super(target);
		}
		
		public function RemoveAllData():void
		{
			_StatusMentionMe.RemoveAllData();
			_StatusSendbyMe.RemoveAllData();
		}
		
		public function GetOneWeekStatusMentionMe(page:int, commentsPerPage:int = 15):Array
		{
			var today:Date = new Date();
			var AWeekAgo:Date = new Date(today.time - WeiboFansInfo.millisecondsPerDay*7);
			var ary:Array = _StatusMentionMe.GetStatusByDate(AWeekAgo, today);
			
			if(commentsPerPage > ary.length)
				return ary;
			
			var nMaxIndex:int = ((page+1)*commentsPerPage-1 > ary.length) ? (ary.length-1) : (page+1)*commentsPerPage-1;
			return ary.slice(page*commentsPerPage, nMaxIndex);
		}
		
		public function OneDayStatusCountsReady():void
		{
			
		}
		
		public function OneWeekStatusToMeReady():void
		{
			var Evt:WeiboEvent = new WeiboEvent(WeiboDataEvent.GET_ONEWEEK_STATUS_MENTION_ME_SUCCESS);
			dispatchEvent(Evt);
		}
		
		public function UpdateStatusSuccess():void
		{
			var Evt:WeiboEvent = new WeiboEvent(WeiboDataEvent.UPDATE_SUCCESS);
			dispatchEvent(Evt);
		}

	}
}